package com.jd.controller;

import com.jd.pojo.Order;
import com.jd.service.center.MyOrderService;
import com.jd.utils.JDJSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

@Controller
public class BaseController {

    public static final String FOODIE_SHOP_CART="shopcart";
    public static final Integer COMMENT_PAGE_SIZE=10;
    public static final Integer PAGE_SIZE=20;


    //微信支付成功-->支付中心-->天天吃货平台
    // ->回调通知的url
    String payReturnUrl ="http://3x3m7j.natappfree.cc/order/notifyMerchantOrderPaid";


    //支付中心调用地址
//    String paymentUrl="http://payment.t.mukewang.com/foodie-payment/payment/createMerchantOrder";
    String paymentUrl="http://3x3m7j.natappfree.cc/payment/createMerchantOrder";

    //用户上传头像地址

    public static final String IMAGE_USER_FACE_LOCATION="shopcart";



    @Autowired
    private MyOrderService myOrdersService;
    /**
     * 用于验证用户和订单是否有关联关系，避免非法用户调用
     * @return
     */
    protected JDJSONResult checkUserOrder(String userId, String orderId) {
        Order order = myOrdersService.queryMyOrder(userId, orderId);
        if (order == null) {
            return JDJSONResult.errorMsg("订单不存在！");
        }
        return JDJSONResult.ok(order);
    }

}
